package iofile;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @BelongsProject: java-study
 * @BelongsPackage: iofile
 * @Author: gejingyu
 * @Date: 2023/2/8
 * @Description:
 */

public class ObjectInputStream_ {

    public static void main(String[] args) throws IOException, ClassNotFoundException {

        //指定反序列化的文件
        String filePath = "";

        ObjectInputStream objectIntputStream = new ObjectInputStream(new FileInputStream(filePath));

        //读取的顺序需要和保存数据的顺序一致，否则会报异常
        System.out.println(objectIntputStream.readInt());
        System.out.println(objectIntputStream.readBoolean());
        System.out.println(objectIntputStream.readChar());
        System.out.println(objectIntputStream.readDouble());
        System.out.println(objectIntputStream.readUTF());
        System.out.println(objectIntputStream.readObject());

        objectIntputStream.close();

    }
}
